#ifndef GAMEAREA_H
#define GAMEAREA_H

#include <QGraphicsItem>
#include <QtCore>
#include <QVector>
#include <QPainter>
#include <QMap>

#include "defines.h"
#include "snakefield.h"
#include "snakesnake.h"
#include "snakebonus.h"

class GameArea : public QGraphicsItem
{
private:
    SnakeField *field;
    QMap<quint32, SnakeSnake* > snakes;
    QMap<quint32, quint32> playersPoints;
    QMap<quint32, SnakeBonus* > bonuses;
    quint32 mySnakeID;



public:
    GameArea();

    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);


    void setFieldSize(Point size);
    void setField(QString map);

    void setMySnakeID(quint32 ID);

    void addSnake(quint32 ID, QList<Point> body);
    void deleteSnake(quint32 ID);

    void addBonus(quint32 ID, Point pos, quint32 type);
    void replaceBonus(quint32 ID, Point pos, quint32 type);
    void deleteBonus(quint32 ID);

    void increaseSnake(quint32 ID);
    void decreaseSnake(quint32 ID);

    void addPointToPlayer(quint32 ID, quint32 points);
    QList< QPair<quint32, quint32> > getPointOfPlayers();


    //void updateSituation(QString *events);
    void killSnakeAndRespawn(quint32 ID, QList<Point > body);
    void moveSnake(quint32 ID, char direction);

};

#endif // GAMEAREA_H
